package main

import (
	"fmt"
	"io"
	"os"
)

func main() {
	f, err := os.Create("../file/20211029.vim")

	if err != nil {
		fmt.Println("open file faild,err=", err)
		return
	}
	f, err = os.OpenFile("../file/20211029.vim", os.O_RDWR, 6)
	if err != nil {
		fmt.Println("open file faild,err=", err)
		return
	}
	defer f.Close()

	for i := 0; i < 10; i++ {
		f.WriteString("hello q\n")
		f.Seek(0, io.SeekEnd)
	}

	//按字节写

	for i := 0; i < 20; i++ {
		off, _ := f.Seek(0, io.SeekEnd)
		f.WriteAt([]byte("hello wdc\n"), off)
	}

}
